home *** CD-ROM | disk | FTP | other *** search
- #include <windows.h>
- #include <dos.h>
- #include <stdio.h>
- #include "delevent.h"
-
- #if !defined(__FLAT__)
- #pragma options -WD -xc//makes all functions in a DLL exportable
- //#pragma option -xc //Safe exceptions
- #define FARVTABLE _huge
- #else
- #define FARVTABLE
- #endif
-
- //we use huge so that we can have far vtbls and not export the whole class
- class FARVTABLE TDLLClass{
- char Buffer[80];
- int InternalValue;
- TEvent FEvent;
-
- virtual void SetValue(int Info){InternalValue = Info;}
- virtual int GetValue(){return InternalValue;}
- virtual void SetEvent(TEvent func){FEvent = func;};
-
-
- public:
- TDLLClass():InternalValue(0){FEvent.Code = NULL;};
-
- virtual void ShowThevalue()
- {
- wsprintf(Buffer, "The value %d\nCOM to da Max!!!!",InternalValue);
- MessageBox(NULL,Buffer,"From The C++ DLL",MB_OK);
- }
-
- virtual void DoEvent()
- {
- if (FEvent.Code != NULL)
- ((TNotifyEvent)FEvent.Code)(FEvent.Self,(const void *)this);
- }
- };
-
- extern "C" {
-
- TDLLClass* _export _cdecl CONSTRUCTCLASS()
- {
- return new TDLLClass;
- };
-
- void _export _cdecl DESTRUCTCLASS(TDLLClass *DLLClass)
- {
- if (DLLClass != NULL)
- delete DLLClass;
- };
- }
-
-